<template>
  <!--清算账户维护申请录入页面弹出框-->
  <el-dialog
    title="清算账户维护申请录入设置"
    center
    :visible.sync="open"
    width="1024px"
    :close-on-click-modal="false"
    @close="closeFn"
  >
    <el-form ref="settingsForm" :model="formData" :rules="rules" label-width="135px">
      <el-row type="flex" v-if="formData.rspId">
        <el-col :span="12">
          <el-form-item label="交易流水号：" prop="rspId">
            <el-input v-model="formData.rspId" placeholder="交易流水号" disabled/>
          </el-form-item>
        </el-col>
        <el-col :span="12"></el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="清算行行号：" prop="clscode">
            <el-input v-model="formData.clscode" placeholder="清算行行号" disabled/>
          </el-form-item>
        </el-col>
        <el-col :span="12"></el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="清算行行名：" prop="clsbrname">
            <el-input v-model="formData.clsbrname" placeholder="清算行行名" disabled/>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="自动拆借余额最低控制金额币种：" prop="curcd">
            <el-input v-model="formData.curcd" placeholder="自动拆借余额最低控制金额币种" disabled/>
          </el-form-item>
        </el-col>
        <el-col :span="12"></el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="自动拆借余额最低控制金额：" prop="intrbklnrmnglmt">
            <HtAmountInput v-model="formData.intrbklnrmnglmt" placeholder="自动拆借余额最低控制金额"/>
          </el-form-item>
        </el-col>
        <el-col :span="12"></el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="资金池余额最低控制金额币种：" prop="curcd1">
            <el-input v-model="formData.curcd1" placeholder="资金池余额最低控制金额币种" disabled/>
          </el-form-item>
        </el-col>
        <el-col :span="12"></el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="资金池余额最低控制金额：" prop="fndsofpoolrmnglmt">
            <HtAmountInput v-model="formData.fndsofpoolrmnglmt" placeholder="资金池余额最低控制金额"/>
          </el-form-item>
        </el-col>
        <el-col :span="12"></el-col>
      </el-row>

      <el-row>
        <el-col :span="24">
          <el-form-item label="附言：" prop="remarks">
            <el-input type="textarea" v-model="formData.remarks" placeholder="备注" maxlength="256" show-word-limit/>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submitForm" :loading="isLoading">提交</el-button>
    </div>
  </el-dialog>
</template>
<script>
import {save} from "@/api/cnaps/saps/clearAcctInfoQuery/clear_maintenance_entry.js";
import {log} from "util";
import HtAmountInput from "@/views/components/HtAmountInput/index.vue";

export default {
  name: "EntryQuery",
  components: {HtAmountInput},
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    formData: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      // 是否显示弹出层
      open: false,
      isLoading: false,
      rules: {
        intrbklnrmnglmt: [
          {
            required: true,
            message: "必填",
            trigger: "blur",
          },
        ],
        fndsofpoolrmnglmt: [
          {
            required: true,
            message: "必填",
            trigger: "blur",
          },
        ],
      },
    };
  },
  mounted() {
  },
  methods: {
    // 表单重置
    reset() {
      this.resetForm("settingsForm");
      this.$set(this, "formData", {});
    },
    closeFn() {
      this.open = false;
      this.reset();
    },
    show() {
      this.open = true;
    },
    submitForm() {
      this.$refs["settingsForm"].validate((valid) => {
        if (valid) {
          this.isLoading = true;
          save(this.formData)
            .then((res) => {
              this.msgSuccess("提交成功！");
              this.isLoading = false;
              this.closeFn();
              this.$emit("editComplete", true);
            })
            .catch((err) => {
              this.isLoading = false;
            });
        }
      });
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
